from django.urls import path
from . import views
from django.contrib.auth.views import LoginView, LogoutView, PasswordChangeView, PasswordChangeDoneView, \
    PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView
from django.urls import reverse_lazy

app_name = "account"

urlpatterns = [
    # path('login/', views.user_login, name='user_login'),  自定义登录页面
    path('login/', LoginView.as_view(template_name='account/login.html'), name="user_login"),
    path('logout/', LogoutView.as_view(template_name='account/logout.html'), name="user_logout"),
    path('register/', views.register, name="user_register"),
    path('password-change/', PasswordChangeView.as_view(template_name='registration/password_change_form.html',
                                                        success_url=reverse_lazy('account:password_change_done')),
         name="password_change"),
    path('password-change-done/',
         PasswordChangeDoneView.as_view(template_name='registration/password_change_done.html'),
         name="password_change_done"),
    path('password-reset/', PasswordResetView.as_view(template_name='registration/password_reset_form.html',
                                                      email_template_name='registration/password_reset_email.html',
                                                      subject_template_name='registration/password_reset_subject.txt',
                                                      success_url=reverse_lazy('password_reset_done')),
         name="password_reset"),
    path('password-reset-done/',
         PasswordResetDoneView.as_view(template_name='registration/password_reset_done.html'),
         name="password_reset_done"),
    path('password-reset-confirm/',
         PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html',
                                          success_url=reverse_lazy('password_reset_complete')),
         name="password_reset_done"),
    path('password-reset-complete/',
         PasswordResetConfirmView.as_view(template_name='registration/password_reset_complete.html'),
         name="password_reset_complete"),
]
